# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=homepwn
pkgver=31.0803981
pkgrel=7
pkgdesc='Swiss Army Knife for Pentesting of IoT Devices.'
groups=('blackarch' 'blackarch-scanner' 'blackarch-recon' 'blackarch-fuzzer'
        'blackarch-exploitation')
arch=('any')
url='https://github.com/ElevenPaths/HomePWN'
license=('GPL3')
depends=('python' 'python-prompt_toolkit' 'wireshark-cli' 'screen' 'hostapd'
         'dnsmasq' 'libxml2' 'cups' 'nmap' 'tcpdump' 'bluez' 'bluez-tools'
         'pcsc-tools' 'glib2' 'python-dbus' 'wondershaper' 'libpcap')
makedepends=('git')
source=("$pkgname::git+https://github.com/ElevenPaths/HomePWN.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE.md

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python homePwn.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

